package edu.jmu.annotation;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AnnotationAssembleTest {

	@Test
	public void testAnnotation() {
		System.out.println("<!-- 注解演示 -->");
		String xmlPath = "beansAnnotation.xml";
		ApplicationContext context = new ClassPathXmlApplicationContext(xmlPath);
		UserController uc = (UserController)context.getBean("userController");
		
		System.out.println(uc);
		uc.save();
	}
	
	@Test
	public void testAutoWire(){
		System.out.println("<!-- 基于XML的自动装配演示 -->");
		String xmlPath = "beansAutoWire.xml";
		ApplicationContext context = new ClassPathXmlApplicationContext(xmlPath);
		UserController uc = (UserController)context.getBean("userController");
		
		System.out.println(uc);
		uc.save();
	}

}
